<template>
<Row class="layout-content-body">
  <dtable :columnsList="columns" v-model="dataAll" :totals="total" check read @get="get" @refresh="getall()" :loading="loading"></dtable>
</Row>
</template>

<script>
import { timeFormat, currency } from '@/common/filter'
import dtable from '@/components/table/etable.vue' // 采用biztable
import moment from 'moment'
export default {
    data () {
        return {
            loading: false, // 数据刷新遮罩层
            columns: [
        // 多选框
                {
                    title: '案件名称',
                    key: 'Title'
                },
                {
                    title: '案件编号',
                    key: 'No'
                },
                {
                    title: '单位',
                    key: 'DeptName'
                },
                {
                    title: '责任人',
                    key: 'Creater'
                },
                {
                    title: '审核时间',
                    key: 'Utime',
                    render: (h, params) => {
                        return h(
                            'span',
                            {},
                            moment(params.row.ctime).format('YYYY-MM-DD HH:mm')
                            )
                    }
                },
                {
                    title: '当前状态',
                    key: 'Status',
                    render: (h, {row}) => {
                        let str = ''
                        let color = 'default'
                        switch (row.Status) {
                        case 2:
                            str = '预约审核中'
                            color = '#80848f'
                            break
                        case 3:
                            str = '待送检'
                            color = '#5cadff'
                            break
                        case 4:
                            str = '检验中'
                            color = '#2d8cf0'
                            break
                        case 5:
                            str = '鉴定中'
                            color = '#2d8cf0'
                            break
                        case 6:
                            str = '待取件'
                            color = '#c3da7b'
                            break
                        case 7:
                            str = '已完成'
                            color = '#19be6b'
                            break

                        }
                        return h('Tag', {
                            props: {
                                type: 'border',
                                name: str,
                                color: color
                            }
                        }, str)
                    }
                }
            ], // 表格样式
            dataAll: [], // 表格数据来源
            templist: [],
            dataShow: true, // 是否显示表格数据查看表单
            showTemp: false,
            total: 0,
            orderData: {
                edit: true,
                temp: ''
            },
            jyType: [
                {
                    name: '痕迹',
                    value: 0,
                    children: [
                        {
                            name: '手印',
                            value: 0
                        },
                        {
                            name: '足迹',
                            value: 1
                        },
                        {
                            name: '工具',
                            value: 2
                        },
                        {
                            name: '枪弹',
                            value: 3
                        },
                        {
                            name: '特殊',
                            value: 4
                        },
                        {
                            name: '爆炸',
                            value: 5
                        },
                        {
                            name: '其它',
                            value: 6
                        }
                    ]
                },
                {
                    name: '法医',
                    value: 1,
                    children: [
                        {
                            name: '尸体',
                            value: 0
                        },
                        {
                            name: '活体',
                            value: 1
                        },
                        {
                            name: '其它',
                            value: 2
                        }
                    ]
                },
                {
                    name: 'DNA',
                    value: 2,
                    children: [
                        {
                            name: '案件检验',
                            value: 0
                        },
                        {
                            name: '违法犯罪人员血样',
                            value: 1
                        },
                        {
                            name: '其它',
                            value: 2
                        }
                    ]
                },
                {
                    name: '理化',
                    value: 3,
                    children: [
                        {
                            name: '毒品',
                            value: 0
                        },
                        {
                            name: '毒物',
                            value: 1
                        },
                        {
                            name: '微量物证',
                            value: 2
                        },
                        {
                            name: '酒精含量',
                            value: 3
                        },
                        {
                            name: '其它',
                            value: 4
                        }
                    ]
                },
                {
                    name: '文检',
                    value: 4,
                    children: [
                        {
                            name: '笔记',
                            value: 0
                        },
                        {
                            name: '印章',
                            value: 1
                        },
                        {
                            name: '其他',
                            value: 2
                        }
                    ]
                },
                {
                    name: '电子物证',
                    value: 5,
                    children: [
                        {
                            name: '手机',
                            value: 0
                        },
                        {
                            name: '电脑',
                            value: 1
                        },
                        {
                            name: '存储设备',
                            value: 2
                        },
                        {
                            name: '其它',
                            value: 3
                        }
                    ]
                }
            ],
            jyCategory: [],
            flag: false,
            formItem: {
                Id: '',
                User: '',
                Phone: '',
                Remark: ''
            }
        }
    },
    components: {
        dtable
    },
    computed: {},
    watch: {},
    methods: {
        ansyOk () {
            console.log(this.formItem)
            this.$api.UpdateTodoStatus(this.formItem).then(res => {
                if (res.code == 0) {
                    console.log('success')
                    this.getall()
                }
            })
        },
        next () {
            this.flag = true
        },
        getall () {
            this.loading = true
            let data = {
                busyName: 'sf_case'
            }
            this.$api.GetAssetsbuyUser(data).then(res => {
                console.debug(res.Data)
                if (!res.error) {
                    this.dataAll = res.Data
                    if (this.dataAll) {
                        this.total = this.dataAll.length
                    }
                } else {
                    this.$Message.error(res.message)
                }
            })
            this.loading = false
        },

        get (data) {
            console.log(data)
            this.orderData.order = data
            this.orderData.edit = false
            this.orderData.type = 1
            this.$router.push({
                name: '司法检验审核',
                params: {
                    orderData: this.orderData
                }
            })
        }
    },
    mounted () {
        this.getall()
    }
}
</script>
